Integer Divides Sum of Coprime Numbers Less Than It

Theorem

For any integer n>2 we have that

n1kn1gcd(n,k)=1k.
Proof

Consider the sum on the right reduced modulo n, noting that of course gcd(n,k)=gcd(n,nk). This means that for each k which appears on the right hand side, so does nk given also that

1kn11nkn1.

When adding these pairs, we have k+nk=n0(modn). As such, we can pair all elements in the sum such that each pair adds to zero.

The only way in which this may fail is if k=nk, however this implies n=2k and since gcd(k,n)=1, this means that k=1 and n=2, a case which we disregarded in the assumption of the theorem, and for which the result does not hold.